<template>
  <div>
    <!-- 选项卡 -->
    <van-tabbar
      v-model="selectedCard"
      safe-area-inset-bottom
      @change="onChange"
      active-color="#FF9F0A"
    >
      <van-tabbar-item name="/" icon="home-o">
        <span class="iconTitle">主页</span>
        <template #icon>
          <span class="iconfont icon-shouye-shouye"></span>
        </template>
      </van-tabbar-item>
      <van-tabbar-item name="/chat" icon="wechat-moments">
        <span class="iconTitle">橙信圈</span>
        <template #icon> <span class="iconfont icon-yingyong"></span> </template
      ></van-tabbar-item>
      <van-tabbar-item name="/informations" icon="more-o">
        <span class="iconTitle">信息</span>
        <template #icon>
          <span class="iconfont icon-xiaoxi"></span>
        </template>
      </van-tabbar-item>
      <van-tabbar-item name="/mine" icon="manager-o">
        <span class="iconTitle">我的</span>
        <template #icon>
          <span class="iconfont icon-my"></span>
        </template>
      </van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  data() {
    return {
      selectedCard: "/",
    };
  },
  methods: {
    onChange(a) {
      this.$router.replace(a);
    },
  },
  watch: {
    "$route.path"() {
      this.selectedCard = this.$route.path;
    },
  },
};
</script>

<style lang="scss" scoped>
.van-tabbar {
  height: 98px;
}
.iconTitle {
  font-size: 12px;
}
.iconfont {
  font-size: 48px;
}
</style>